//
//  UIButton+Extension.swift
//  01-WeiBo
//
//  Created by 李晓东 on 17/6/26.
//  Copyright © 2017年 PeanutXu. All rights reserved.
//

import UIKit

extension UIButton{
 
    convenience init(imageName:String, backImageName:String) {
        self.init()
        setImage(UIImage(named:imageName), for:.normal)
        setImage(UIImage(named:imageName+"_highlighted"), for: .highlighted)
        
        setBackgroundImage(UIImage(named:backImageName), for: .normal)
        setBackgroundImage(UIImage(named:backImageName+"_highlighted"), for: .highlighted)
        sizeToFit()
        
    }
    
    convenience init(titleName:String, color:UIColor = UIColor.blue, imageName:String) {
        self.init()
        setTitle(titleName, for: .normal)
        setTitleColor(color, for: .normal)
        setBackgroundImage(UIImage(named:imageName), for: .normal)
        sizeToFit()
    }
}
